/**
 * 
 */
package STUDENTS.PHAMHONGSON.Eg07142016;

/**
 * @author WindChime
 *
 */
public class isFriendshipAvailableCheckerModel {
	
	public String CheckedResult(PersonalInfo obj)
	{
		if (obj.getpAge()<19) 
			obj.setFriendshipAvailable(false);
		else if (obj.getpSex().toUpperCase().equals("FEMALE") && (obj.getpMaritalStatus().toUpperCase().equals("SINGLE")
				||obj.getpMaritalStatus().toUpperCase().equals("DIVORCED")))
			obj.setFriendshipAvailable(true);
		else if (obj.getpSex().toUpperCase().equals("MALE") && obj.getpAge()>=22 && (obj.getpMaritalStatus().toUpperCase().equals("SINGLE")
				||obj.getpMaritalStatus().toUpperCase().equals("DIVORCED")))
			obj.setFriendshipAvailable(true);
		else obj.setFriendshipAvailable(false);
		
		String outPut = "";
		if (obj.isFriendshipAvailable()==true)
			outPut = "Welcome " + obj.getpFullName() + ".\nThanks for registering. \nSo, Now you can join to find a new friend.";
		else outPut = "Sorry, you don't have enough permisions to join!";
		
		return outPut;
	}
}
